import Vue from "vue";
import axios from "axios";
Vue.prototype.$axios = axios;
// 在所有发送网络请求的地方使用
import nprogress from 'nprogress'
// 导入所需要的样式
import 'nprogress/nprogress.css'
axios.defaults.baseURL = "http://localhost:8080/";
axios.defaults.withCredentials = true;
axios.interceptors.request.use((config) => {
  nprogress.start();
  return config;
});

axios.interceptors.response.use((resp) => {
  nprogress.done();
  return resp.data;
});

axios.textConfig = {
  headers: {
    "Content-Type": "text/plain",
  },
};

export default axios;
